package com.aitaoxue.palx.fragment;

import io.rong.imkit.fragment.ConversationListFragment;
import io.rong.imlib.model.Conversation;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.aitaoxue.palx.R;

public class IMFragment extends Fragment {

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.fragment_im, container, false);

		ConversationListFragment listFragment = ConversationListFragment
				.getInstance();
		Uri uri = Uri
				.parse("rong://"
						+ getActivity().getApplicationInfo().packageName)
				.buildUpon()
				.appendPath("conversationlist")
				.appendQueryParameter(
						Conversation.ConversationType.PRIVATE.getName(),
						"false")
				.appendQueryParameter(
						Conversation.ConversationType.APP_PUBLIC_SERVICE
								.getName(),
						"false")
				.appendQueryParameter(
						Conversation.ConversationType.SYSTEM.getName(), "false")
				.build();
		listFragment.setUri(uri);

		getChildFragmentManager().beginTransaction().replace(R.id.container,
				listFragment).commit();

		return view;
	}
	
	

}
